package org.kjs.common.clone;

import org.kjs.common.clone.exception.CloneNotSupportedException;

/**
 * Created by IntelliJ IDEA.
 * User: KJS
 * Date: 11-8-15
 * Time: 下午7:00
 * To change this template use File | Settings | File Templates.
 */

/**
 * Clone object's field.
 * @param <V> Object's type
 */
public interface AccessibleFieldStructure<V> {

    /**
     * Object's cloneable field's set value method prefix, it must be 'set'.
     */
    String ACCESSIBLE_FIELD_METHOD_SET = "set";
    /**
     * Object's cloneable field's get value method prefix, it must be 'get'.
     * If the field value type is boolean or java.lang.Boolean, the prefix can be 'is'.
     */
    String ACCESSIBLE_FIELD_METHOD_GET = "get";
    /**
     * Object's cloneable field's get value method prefix.
     * If the field value is boolean or java.lang.Boolean, the prefix can be 'is'.
     * Otherwise it can be only 'get'.
     */
    String ACCESSIBLE_FIELD_METHOD_IS = "is";

    /**
     * Clone object's field value.
     * @param originalItem field value get object
     * @param clonedItem field value set object
     * @param clone clone object's tool
     * @throws CloneNotSupportedException if clone object's field value fail, the exception will be thrown.
     */
    void cloneAccessibleField (V originalItem, V clonedItem, Clone clone) throws CloneNotSupportedException;

}
